import 'package:json_annotation/json_annotation.dart';

part 'recipe_detail_info_api.g.dart';

@JsonSerializable(explicitToJson: true)
class ResponseRecipeDetailApi {
  final List<RecipeStep>? stepList;
  final String? cookTimeUnit;
  final int? status;
  final int? useFoodLib;
  final String? easyLevelDesc;
  final String? likes;
  final String? mainImg;
  final String? tool;
  final String? videoCoverUrls;
  final List<RecipeCategory>? categoryList;
  final String? noUseFoodDesc;
  final String? videoIds;
  final int? cookTime;
  final bool? isWeekMenu;
  final String? name;

  final String? imageIds;
  final String? imageUrls;
  final String? id;
  final String? videoUrls;
  final int? isControl;
  final int? cookType;
  final List<RecipeFood>? foodList;
  final String? tips;
  final String? videoCoverIds;
  final String? view;
  final String? dineNumber;
  final String? desc;
  final int? isShowControl;
  final String? author;
  final String? collection;

  ResponseRecipeDetailApi({
    this.stepList,
    this.cookTimeUnit,
    this.status,
    this.useFoodLib,
    this.easyLevelDesc,
    this.likes,
    this.mainImg,
    this.tool,
    this.videoCoverUrls,
    this.categoryList,
    this.noUseFoodDesc,
    this.videoIds,
    this.cookTime,
    this.isWeekMenu,
    this.name,

    this.imageIds,
    this.imageUrls,
    this.id,
    this.videoUrls,
    this.isControl,
    this.cookType,
    this.foodList,
    this.tips,
    this.videoCoverIds,
    this.view,
    this.dineNumber,
    this.desc,
    this.isShowControl,
    this.author,
    this.collection,
  });

  factory ResponseRecipeDetailApi.fromJson(Map<String, dynamic> json) =>
      _$ResponseRecipeDetailApiFromJson(json);

  Map<String, dynamic> toJson() => _$ResponseRecipeDetailApiToJson(this);
}

@JsonSerializable()
class RecipeStep {
  final String? menuId;
  final String? stepImgUrl;
  final String? stepImgIds;
  final int? id;
  final String? stepImg;
  final String? title;
  final String? stepPara;
  final int? step;
  final String? desc;

  RecipeStep({
    this.menuId,
    this.stepImgUrl,
    this.stepImgIds,
    this.id,
    this.stepImg,
    this.title,
    this.stepPara,
    this.step,
    this.desc,
  });

  factory RecipeStep.fromJson(Map<String, dynamic> json) =>
      _$RecipeStepFromJson(json);

  Map<String, dynamic> toJson() => _$RecipeStepToJson(this);
}

@JsonSerializable()
class RecipeCategory {
  final String? id;
  final dynamic status;
  final dynamic belongRecipeCount;
  final dynamic childrenList;
  final dynamic nodeType;
  final dynamic imageUrlId;
  final dynamic appShow;
  final dynamic imageUrl;
  final dynamic lang;
  final dynamic sort;
  final dynamic name;
  final dynamic parentId;

  RecipeCategory({
    this.id,
    this.status,
    this.belongRecipeCount,
    this.childrenList,
    this.nodeType,
    this.imageUrlId,
    this.appShow,
    this.imageUrl,
    this.lang,
    this.sort,
    this.name,
    this.parentId,
  });

  factory RecipeCategory.fromJson(Map<String, dynamic> json) =>
      _$RecipeCategoryFromJson(json);

  Map<String, dynamic> toJson() => _$RecipeCategoryToJson(this);
}

@JsonSerializable()
class RecipeFood {
  final String? menuId;
  final String? foodId;
  final String? foodName;
  final String? id;
  final String? unit;
  final String? grams;
  final String? secondUnit;
  final String? secondNum;
  final String? remark;

  RecipeFood({
    this.menuId,
    this.foodId,
    this.foodName,
    this.id,
    this.unit,
    this.grams,
    this.secondUnit,
    this.secondNum,
    this.remark,
  });

  factory RecipeFood.fromJson(Map<String, dynamic> json) =>
      _$RecipeFoodFromJson(json);

  Map<String, dynamic> toJson() => _$RecipeFoodToJson(this);
}
